package com.ycg.vue.modules.admin.mapper;

import com.ycg.vue.Annotation.AutoInsert;
import com.ycg.vue.Entity.Dto.UserDto;
import com.ycg.vue.Entity.UserEntity;
import com.ycg.vue.Entity.Vo.UserVo;
import com.ycg.vue.Enum.AutoInsertType;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @Description
 * @Author jink
 * @Date 2024/5/21
 */
@Mapper
public interface UserManageMapper {
    List<UserVo> list(@Param("user") UserDto user, @Param("id") String id);

    Long total(@Param("user") UserDto user,@Param("id") String id);

    UserVo getUserById(@Param("id") String id);

    @Delete("delete from user where id = #{id}")
    void deleteUserById(@Param("id") String id);

    @Select("select f.url from user u LEFT JOIN file f ON u.head_image = f.id  where u.id = #{id}")
    String headImg(@Param("id") String id);

    @AutoInsert(value = AutoInsertType.UPDATE)
    void updateUser(@Param("user") UserEntity user);
}
